import { PropsWithChildren } from "react";
import { useLaunch } from "@tarojs/taro";
import { QueryClient, QueryClientProvider } from "react-query";
import "./app.scss";
import "./router";

const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      refetchOnWindowFocus: false,
    },
  },
});

function App({ children }: PropsWithChildren) {
  useLaunch(() => {
    console.log("App launched.");
  });

  // children 是将要会渲染的页面
  return (
    <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
  );
}

export default App;
